From: Dusty Mabe Date: Thu, 1 Jun 2023 13:23:41 +0000 (-0400) Subject: lib/deploy: skip fallocate call when requested size is 0 X-Git-Tag: archive/raspbian/2023.7-3+rpi1~1^2~9^2~1^2~30^2 X-Git-Url: https://dgit.raspbian.org/%22http:/www.example.com/cgi/%22https:/www.github.com/%22bookmarks:///%22http:/www.example.com/cgi/%22https:/www.github.com/%22bookmarks:/?a=commitdiff_plain;h=68d1d9a7fc08c281174f57b638fa06f7aea73601;p=ostree.git lib/deploy: skip fallocate call when requested size is 0 If the requested size is 0 then of course we have enough room 🙂 This avoids the fallocate call returning an EINVAL. Closes: #2869 --- diff --git a/src/libostree/ostree-sysroot-deploy.c b/src/libostree/ostree-sysroot-deploy.c index c5ced04c..d6304734 100644 --- a/src/libostree/ostree-sysroot-deploy.c +++ b/src/libostree/ostree-sysroot-deploy.c @@ -2446,6 +2446,14 @@ get_kernel_layout_size (OstreeSysroot *self, OstreeDeployment *deployment, guint static gboolean dfd_fallocate_check (int dfd, __off_t len, gboolean *out_passed, GError **error) { + /* If the requested size is 0 then return early. Passing a 0 len to + * fallocate results in EINVAL */ + if (len == 0) + { + *out_passed = TRUE; + return TRUE; + } + g_auto (GLnxTmpfile) tmpf = { 0, };